package com.dhl.fin.api.controller;

import com.dhl.fin.api.common.controller.CommonController;
import com.dhl.fin.api.common.dto.ApiResponse;
import com.dhl.fin.api.common.util.DateUtil;
import com.dhl.fin.api.domain.MensesRemindTask;
import com.dhl.fin.api.dto.TipMessageDTO;
import com.dhl.fin.api.dto.WeChatLoginReqDTO;
import com.dhl.fin.api.service.AbilityServiceCenterService;
import com.dhl.fin.api.service.MensesRemindTaskService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.bind.annotation.RestController;

/**
 * @author CuiJianbo
 * @since 2025/5/19
 */
@Transactional(rollbackFor = Exception.class)
@RestController
@Slf4j
@RequestMapping("menses")
public class MensesRemindTaskController extends CommonController<MensesRemindTask> {

    @Autowired
    private MensesRemindTaskService mensesRemindTaskService;

    @Autowired
    private AbilityServiceCenterService abilityServiceCenterService;


    @ResponseBody
    @GetMapping("calendar")
    public ApiResponse getMensesCalender(MensesRemindTask mensesRemindTask) throws Exception {
        return ApiResponse.success(mensesRemindTaskService.getMensesCalenderData(mensesRemindTask));
    }


    @ResponseBody
    @GetMapping("sendMsg")
    public ApiResponse testMensesRemindTask() {
        TipMessageDTO tipMessageDTO = TipMessageDTO.builder()
                .openId("oWayu7VfjYdLSV--qUtPB028k8LM")
                .remindName("测试数据")
                .remindDescription("今天是月经期的第一天，注意多休息不要劳累")
                .remindType("其他类")
                .remainTime("2天")
                .remindWayType("提前提醒")
                .build();
        abilityServiceCenterService.sendSubscribeMsgMiniProgram(tipMessageDTO);
        return ApiResponse.success();
    }


}
